﻿@using ZBJF.Warranty.WebProvider
@{
    ViewBag.Title = "销售人员角色";
}
@section Header{
    @Scripts.Render("~/bundles/datatable")
    @Styles.Render("~/Content/datatable")
}
<ul class="nav nav-tabs">
    <li class="active"><a href="/SellerEmployeeRole/">销售人员角色列表</a></li>
    <li class="Add-R"><a href="/SellerEmployeeRole/Edit/0">添加销售人员角色</a></li>
</ul>
<form id="searchForm" class="breadcrumb form-search">
    <div>
        <label>关键词：</label><input id="Keyword" name="Keyword" class="input-medium" placeholder="请输入搜索关键词" type="text" value="" maxlength="50" />
        <input id="btnSubmit" class="btn btn-primary Search-R" type="button" value="Search" onclick="search();">
    </div>
</form>
<div class="table-responsive dataTables_wrapper">
    <table id="list" class="table table-striped table-bordered table-hover">
        <thead>
            <tr>
                <th width="20">序号</th>
                <th width="100">角色名</th>
                <th width="100">角色代码</th>
                <th width="100">简介</th>
                <th width="100">是否可用</th>
                <th width="100">操作</th>
            </tr>
        </thead>
    </table>
</div>
@section scripts{
    <script type="text/javascript">
        var isSearch = false;
        $(function () {
            var objTable = $("#list")
                .dataTable({
                    fnDrawCallback: function () {
                        ControlPermissionOperate();
                    },
                    "sAjaxSource": "/SellerEmployeeRole",
                    aoColumns: [
                        {
                            "mData": null, bSortable: false, "fnRender": function (nRow) {
                                return nRow.iDataRow + 1;
                            }
                        },
                        {
                            "mData": "RoleName", "fnRender": function (nRow) {
                                return "<a class='Edit-R'  href='/SellerEmployeeRole/Edit/" + nRow.aData.ID + "' title='edit'>" + nRow.aData.RoleName + "</a>";
                            }
                        },
                        { "mData": "RoleCode" },
                        { "mData": "Intro" },
                        {
                            "mData": null, fnRender: function (nRow) {
                                return nRow.aData.IsAvailable ? bootStrapOkIncon : bootStrapRemoveIncon;
                            }
                        },
                        {
                            "mData": null, bSortable: false, fnRender: function (nRow) {
                                var html = "<a class='Edit-R' href='/SellerEmployeeRole/Edit/" + nRow.aData.ID + "' title='edit'><i class='icon-edit'></i></a>";
                                html += "<a class='Edit-R' href=\"javascript:UpdateStatus('" + nRow.aData.ID + "'," + !nRow.aData.IsAvailable + ",'/SellerEmployeeRole/UpdateStatus','list')\" title='" + (nRow.aData.IsAvailable ? "禁用" : "启用") + "'>" + (nRow.aData.IsAvailable ? bootStrapRemoveIncon : bootStrapOkIncon) + "</a>";
                                return html;
                            }
                        }
                    ]
                });
        });
        function search() {
            /*给查询对象赋值*/
            queryParamList.Keyword = ($("#Keyword").val());
            $("#list").dataTable().fnDraw();
        }
    </script>
}